<?php
namespace App\Http\Queries;

use App\Models\Goods;
use Illuminate\Http\Request;
use Spatie\QueryBuilder\QueryBuilder;
use Spatie\QueryBuilder\AllowedFilter;

class GoodsQuery extends QueryBuilder
{
    public function __construct()
    {

        parent::__construct(Goods::query());
        $this->allowedIncludes("authors","goodsCategory","goodsContent","goodsImages")
            ->allowedFilters([
                "name",
                AllowedFilter::exact("goods_category_id"),
                AllowedFilter::scope("is_new"),
            ])->where("on_sale",1);

    }
}
